﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RBAC.Web.Models;
using RBAC.Web.Service;
using System.Web.Mvc;

namespace RBAC.Web.Mapper
{ 
      // Mapper for picklist
	public class  FunctionStatusMapper
    {	
		public static List<CustomListItem> GetAllFunctionStatus()
		{
			var result = new List<CustomListItem>();
					result.Add(new CustomListItem() { Value = 1, Text = "Active" });  			 
					result.Add(new CustomListItem() { Value = 2, Text = "Deactive" });  			 
					return result;
		}	

		public static SelectList GetFunctionStatusSelectListWithDefault()
        {
            List<CustomListItem> temp = GetAllFunctionStatus();
            temp.Add(new CustomListItem() { Value = 0, Text = "All" });
            return GetFunctionStatusSelectList(temp.OrderBy(s => s.Value).ToList());
        }

        public static SelectList GetFunctionStatusSelectList()
        {
            return GetFunctionStatusSelectList(GetAllFunctionStatus());
        }

        private static SelectList GetFunctionStatusSelectList(List<CustomListItem> input)
        {
            return new SelectList(input, "Value", "Text");
        }


	}  
	  

}
	
		

	